<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>成单展示</title>
    <meta name="decorator" content="default"/>
    <link rel="stylesheet" href="${ctxStatic}/bootstrap-table/bootstrap-table.css">
    <script src="${ctxStatic}/bootstrap-table/bootstrap-table.js"></script>
    <script src="${ctxStatic}/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="${ctxStatic}/bootstrap-table/config.js"></script>
</head>
<body>
<form id="searchForm" action="${ctx}/mywork/afterSales/listOnShowDate" method="post"
      class="breadcrumb form-search">
    <ul class="ul-form">
        <ul class="ul-form">
            <li>
                <div class="input-prepend">
                    <span class="add-on">客户类型</span>
                    <sys:customerType name="customerType" cssClass="select-medium" withAll="true"/>
                </div>
                <div class="input-prepend">
                    <span class="add-on">成单产品</span>
                    <sys:productType name="targetproducts" cssClass="select-medium" withAll="true" withWu="true"/>
                </div>
            </li>
            <li>
            <li class="btns">
            </li>
            </li>
        </ul>
        <ul class="ul-form">
            <li>
                <div class="input-prepend">
                        <span class="add-on">
                            客户名称
                        </span>
                    <input name="corporationName" type="text" class="input-medium" placeholder="请输入客户名称"/>
                </div>
                <div class="input-prepend">
                    <span class="add-on">开始时间</span>
                    <input readonly="true" name="beginDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
                <div class="input-prepend">
                    <span class="add-on">结束时间</span>
                    <input readonly="true" name="endDate" type="text" class="input-medium"
                                onmousedown="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
            </li>
            <li class="btns">
                <button id="search" class="btn btn-small btn-primary" type="button">
                    查询<span class="icon-search icon-white"></span>
                </button>
            </li>
            <li class="clearfix"></li>
        </ul>
    </ul>
</form>
<table id="contentTable" data-url="${ctx}/mywork/afterSales/listOnShowDate">
    <thead>
    <tr>
        <th data-align="center" data-formatter="indexFormat">序号</th>
        <th data-field="corporationName" data-sortable="true" data-align="center">
            客户名称
        </th>
        <th data-field="customerType" data-sortable="true" data-align="center">
            客户类型
        </th>
        <th data-field="customerFeature" data-sortable="true" data-align="center">
            客户特点
        </th>
        <th data-field="amount" data-sortable="true" data-align="center">
            成单金额
        </th>
        <th data-field="year" data-sortable="true" data-align="center">
            成单年限
        </th>
        <th data-field="productName" data-sortable="true" data-align="center">
            成单产品
        </th>
        <th data-field="dateCreated" data-sortable="true" data-align="center">
            成单时间
        </th>
        <th data-field="receiver" data-sortable="true" data-align="center">
            收款人
        </th>
        <th data-field="createUsername" data-sortable="true" data-align="center">
            成单人
        </th>
    </tr>
    </thead>
</table>
<script type="text/javascript">
    $(document).ready(function () {
        $("#contentTable").bootstrapTable(
            $.fn.BTConfigSimple({
            pageList: [30, 50, 100],
            pageSize: 30,
            sortName: "dateCreated",
            sortOrder:"desc",
            userQuery:function(){
                return $("#searchForm").refreshByForm().query;
            },
            queryParams: function (params) {
                params.pageNo = params.pageNumber;
                if(params.sortName){
                    params.orderBy = '"'+params.sortName + '" ' + params.sortOrder;
                }
                var userParms = this.userQuery();
                $.extend(params,userParms);
                return params;
            }
        }));
        $("#search").click(function () {
            refresh();
        });
    });
    function indexFormat(v,r,i){
        return i+1;
    }
    //全局函数部分
    function refresh() {
        $("#contentTable").bootstrapTable(
          'refresh',$("#searchForm").refreshByForm());
    }

</script>
</body>
</html>